home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue47 / Clinic / COM / IEBrowsU.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-01-18  |  4.0 KB  |  143 lines

  1. unit IEBrowsU;
  2.  
  3. {$ifdef Windows}
  4.   {$define DelphiLessThan3}
  5.   {$define DelphiLessThan4}
  6. {$endif}
  7. {$ifdef Ver90} { Delphi 2.0x }
  8.   {$define DelphiLessThan3}
  9.   {$define DelphiLessThan4}
  10. {$endif}
  11. {$ifdef Ver93} { C++ Builder 1.0x }
  12.   {$define DelphiLessThan3}
  13.   {$define DelphiLessThan4}
  14. {$endif}
  15. {$ifdef Ver100} { Delphi 3.0x }
  16.   {$define DelphiLessThan4}
  17. {$endif}
  18.  
  19. {$ifdef DelphiLessThan3}
  20.   'Delphi 3 and later only'
  21. {$endif}
  22.  
  23. interface
  24.  
  25. uses
  26.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  27.   StdCtrls, ExtCtrls, ComObj, ShDocVw_Tlb;
  28.  
  29. type
  30.   TForm1 = class(TForm)
  31.     btnAbout: TButton;
  32.     btnEasterEgg: TButton;
  33.     btnWin98: TButton;
  34.     Label1: TLabel;
  35.     btnBrowse: TButton;
  36.     edtURL: TEdit;
  37.     procedure btnAboutClick(Sender: TObject);
  38.     procedure btnEasterEggClick(Sender: TObject);
  39.     procedure btnWin98Click(Sender: TObject);
  40.     procedure btnBrowseClick(Sender: TObject);
  41.   private
  42.     { Private declarations }
  43.   public
  44.     IExplore: IWebBrowser;
  45.   end;
  46.  
  47. var
  48.   Form1: TForm1;
  49.  
  50. implementation
  51.  
  52. {$R *.DFM}
  53.  
  54. {$ifdef DelphiLessThan4}
  55. var
  56.   EmptyParam: OleVariant;
  57. {$endif}
  58.  
  59. procedure TForm1.btnBrowseClick(Sender: TObject);
  60. begin
  61.   IExplore := CreateComObject(Class_InternetExplorer) as IWebBrowser;
  62.   (IExplore.Application as IWebBrowserApp).Visible := True;
  63.   IExplore.Navigate(edtURL.Text, EmptyParam,
  64.     EmptyParam, EmptyParam, EmptyParam)
  65. end;
  66.  
  67. procedure TForm1.btnAboutClick(Sender: TObject);
  68. begin
  69.   IExplore := CreateComObject(Class_InternetExplorer) as IWebBrowser;
  70.   (IExplore.Application as IWebBrowserApp).Visible := True;
  71.   IExplore.Navigate('res://shdocvw.dll/about.dlg', EmptyParam,
  72.     EmptyParam, EmptyParam, EmptyParam)
  73. end;
  74.  
  75. procedure TForm1.btnEasterEggClick(Sender: TObject);
  76. var
  77.   Target: OleVariant;
  78. begin
  79.   IExplore := CreateComObject(Class_InternetExplorer) as IWebBrowser2;
  80.   //Don't need this since Easter Egg comes up in a second (visible) window
  81.   //IExplore.Application.Visible := True;
  82.   Target := 'TheWCEE';
  83.   IExplore.Navigate('res://shdocvw.dll/wcee.htm', EmptyParam,
  84.     Target, EmptyParam, EmptyParam)
  85. end;
  86.  
  87. { Windows 98 Easter Egg Instructions
  88.  
  89.   Invoke the Date/Time Properties applet from Control Panel.
  90.   This can be done by invoking Control Panel first, then
  91.   locating the relevant icon and double-clicking it.
  92.   You can also double-click the Clock in your task bar's
  93.   system tray. Alternatively, run one of these command-lines:
  94.  
  95.     COMMAND DATE/TIME
  96.     COMMAND TIMEDATE.CPL
  97.  
  98.   Click on the Time Zone tab
  99.   The next bit relies on some geography knowledge.
  100.   Hold down the Ctrl key and drag Memphis, Egypt and
  101.   drop it on Memphis, Tennessee.
  102.   Now hold down the Ctrl key and drag Memphis, Tennessee and
  103.   drop it on Seattle, USA
  104.  
  105.   If you got the right locations, a window will appear with
  106.   various pictures that come and go, and the credits list
  107.   will scroll by.
  108.  
  109.   There is a soundtrack as well, so turn your speakers up.
  110.  
  111.   You can circumvent all this trickery by making a new
  112.   shortcut on your Windows98 desktop. Make a shortcut with
  113.   a command-line of:
  114.  
  115.     "C:\Windows\Application Data\Microsoft\Welcome\WelData.Exe" You_are_a_real_rascal
  116.  
  117.   Make sure you go back to the properties for this shortcut
  118.   (right-click and choose properties) and set the Run: option
  119.   to say Minimized.
  120.  
  121.   The soundtrack to this Easter Egg is the file
  122.   C:\Windows\Application Data\Microsoft\Welcome\Welcom98.Wav }
  123. procedure TForm1.btnWin98Click(Sender: TObject);
  124. var
  125.   WinDir: array[0..MAX_PATH-1] of Char;
  126.   CmdLine: String;
  127. const
  128.   RelPath = '\Application Data\Microsoft\Welcome\';
  129.   AppName = 'WELDATA.EXE';
  130.   AppParam = 'You_are_a_real_rascal';
  131. begin
  132.   GetWindowsDirectory(WinDir, MAX_PATH);
  133.   CmdLine := Format('"%s%s%s" %s', [WinDir, RelPath, AppName, AppParam]);
  134.   WinExec(PChar(CmdLine), SW_SHOWMINNOACTIVE);
  135. end;
  136.  
  137. {$ifdef DelphiLessThan4}
  138. initialization
  139.   TVarData(EmptyParam).VType := varError;
  140.   TVarData(EmptyParam).VError := DISP_E_PARAMNOTFOUND
  141. {$endif}
  142. end.
  143.